(function() {
  'use strict';

  angular
    .module('client')
    .directive('info', info);

  info.$inject = [];
  function info() {
    var directive = {
      restrict: 'A',
      link: link,
      controller: InfoController,
      controllerAs: 'infoCtrl',
      binToController: true,
      replace: true,
    };
    return directive;

    function link($scope, element, attrs) {
      $(element).popover({
        trigger: 'hover',
        placement: 'right',
        html: true,
        content: $scope.content,
      });
    }

    InfoController.$inject = ['$scope', 'infoService'];
    function InfoController($scope, infoService) {
      var info = infoService.getInfo();
      $scope.content = infoService.initList(info);
    }
  }
})();
